from django.shortcuts import render
from Record.models import Record
from student.models import Student
# Create your views here.


# 显示我的成绩
def grade(request):
    if request.session.get('is_login',None):  #若session认证为真
        username = request.session.get('username',None)
        student = Student.objects.get(student_id=username)
        # 查询成绩信息
        record = Record.objects.filter(student_id=student.student_id)
        return render(request, 'gradeinfo.html',{'student': student,'record': record})
    else:
        return render(request, 'gradeinfo.html')


